import http from "@/assets/js/http";
const name = "Page"
export default {
    urlFind:'/auth/admin/' + name +'/info',
    urlFindToEdit:'/auth/admin/' + name +'/get',
    urlFindBy:'/auth/admin/' + name +'/list',
    urlSave:'/auth/admin/' + name +'/save',
    urlDelete:'/auth/admin/' + name +'/delete',
    urlDeleteAll:'/auth/admin/' + name +'/delete_many',
    urlCopy:'/auth/admin/' + name +'/copy',
    urlEditMany:'/auth/admin/' + name +'/edit_many',
    urlTree:'/auth/admin/' + name +'/tree',
    urlChoice:'/auth/admin/' + name +'/choice',
    find(id,func){
        http.get(this.urlFind ,{id},res=>{
            func(res)
        })
    },
    findToEdit(id,func){
        http.post(this.urlFindToEdit ,{id},res=>{
            func(res)
        })
    },
    findBy (param,func) {
        http.post(this.urlFindBy, param, res => {
            func(res.data.lists, res.data.query)
        })
    },
    save (data,func){
        http.post(this.urlSave ,data,res=>{
            func(res)
        })
    },
    delete (id,func){
        http.post(this.urlDelete,{id},res=>{
            func(res)
        })
    },
    deleteAll (ids,func){
        http.post(this.urlDeleteAll,{ids},res=>{
            func(res)
        })
    },
    copy (ids,func){
        http.post(this.urlCopy,{ids},res=>{
            func(res)
        })
    },
    editMany (ids,data,func){
        http.post(this.urlEditMany,{
            ids,
            _action:data
        },res=>{
            func(res)
        })
    },
}